package com.mxpio.erp.common.hr.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;

import com.mxpioframework.security.entity.Dept;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_HR_EMPLOYEE")
@Schema(description="员工信息")
public class Employee extends BaseEntity {

	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "EMPLOYEE_CODE_", length = 64)
	@Schema(description = "员工账号")
	@Generator(policy = ResCodeGeneratorPolicy.class)
	private String employeeCode;

	@Column(name = "EMPLOYEE_NAME_", length = 64)
	@Schema(description = "姓名")
	private String employeeName;

	@Column(name = "PHONE_", length = 64)
	@Schema(description = "手机号")
	private String phone;

	@Column(name = "EMAIL_", length = 64)
	@Schema(description = "邮箱")
	private String email;

	@Column(name = "DEPT_", length = 64)
	@Schema(description = "所属部门")
	@Dict(dicCode = "deptCode", dicEntity = Dept.class, dicText = "deptName")
	private String dept;

	@Column(name = "DEGREE_", length = 64)
	@Schema(description = "学历")
	@Dict(dicCode = "MB_ERP_HR_EMPLOYEE_DEGREE") //10 博士 ，20研究生，30本科，40大专，50大专以下
	private String degree;

	@Column(name = "GRADUATE_SCHOOL_", length = 64)
	@Schema(description = "毕业院校")
	private String graduateSchool;

	@Column(name = "EMPLOYEE_STATUS_", length = 64)
	@Schema(description = "员工状态")
	@Dict(dicCode = "MB_ERP_HR_EMPLOYEE_EMPLOYEE_STATUS")//10 在职，20 试用，30 离职， 40 退休，50 返聘
	private String employeeStatus;

	@Dict(dicCode = "ERP_COMMON_YESNO")
	@Schema(description = "是否劳务")
	@Column(name = "IS_LABOR_", columnDefinition="varchar(64) default '0'")//0否 1是
	private String isLabor;

	@Column(name = "DATE_START_CONTRACT_")
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	@Schema(description = "合同开始日期")
	private Date dateStartContract;

	@Column(name = "DATE_END_CONTRACT_")
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	@Schema(description = "合同结束日期")
	private Date dateEndContract;

	@Column(name = "ENTRY_TIME_")
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	@Schema(description = "入职时间")
	private Date entryTime;

	@Column(name = "POST_SUBSIDY_", length = 64)
	@Schema(description = "岗位补贴（有/无）")
	@Dict(dicCode = "MB_SYSTEM_HAVE_NOT") // 1有 0无
	private String postSubsidy;

	@Column(name = "POST_SUBSIDY_AMOUNT_")
	@Schema(description = "岗位补贴额")
	private BigDecimal postSubsidyAmount;

	@Column(name = "BASE_SALARY_", length = 64)
	@Schema(description = "基本工资（固定/不固定）")
	@Dict(dicCode ="MB_ERP_HR_EMPLOYEE_FIXED") //1固定，0不固定
	private String baseSalary;

	@Column(name = "FIXED_SALARY_")
	@Schema(description = "固定工资")
	private BigDecimal fixedSalary;

	@Column(name = "STAY_SUBSIDY")
	@Schema(description = "住宿补贴（有/无）")
	@Dict(dicCode = "MB_SYSTEM_HAVE_NOT")// 1有 0无
	private String staySubsidy;

	@Column(name = "BASE_SALARY_AMOUNT_")
	@Schema(description = "住宿补贴额")
	private BigDecimal staySubsidyAmount;

	@Column(name = "PERFORMANCEBASED_PAY_")
	@Schema(description = "绩效工资")
	private BigDecimal performancebasedPay;

	@Column(name = "BIRTHDAY_")
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	@Schema(description = "员工生日")
	private Date birthday;

	@Column(name = "GENDER_", length = 64)
	@Schema(description = "性别")
	private String gender;

	@Column(name = "AGE_", length = 64)
	@Schema(description = "年龄")
	private Integer age;

	@Column(name = "IDCARD_", length = 64)
	@Schema(description = "身份证")
	private String idcard;
}
